import request from '../utils/request';

/* 用户列表 */
export const getUsersApi = (params) => request.get('/users', {
  params,
});

/* 删除 */
export const deleteUsersApi = (id) => request.delete(`/users/${id}`);

/* 验证字段是否存在 */
export const UsersExistApi = (key, value) => request.get('/users/exist', { params: { key, value } });

/* 添加 */
export const addUserApi = (data) => request.post('/users', data);

/* 获取用户信息根据ID */
export const getUserByIdApi = (id) => request.get(`/users/${id}`);

/* 编辑保存 */
export const editUserApi = (id, data) => request.patch(`/users/${id}`, data);

/* 登录 */
export const loginApi = (data) => request.post('/login', data);

export default {};
